//
//  MainViewController.m
//  SUZHOUBANK
//
//  Created by saberLily on 16/4/11.
//  Copyright © 2016年 RuiFeng-WGCC. All rights reserved.
//

#import "MainViewController.h"
#import "Header.h"


@interface MainViewController ()<LeftMenusViewDelegate,UINavigationControllerDelegate>
{
    BOOL hasView;
    
}
@property (nonatomic,strong) LeftMenusView *leftMenus;
@property (nonatomic,strong) UIImageView *backImageView; /**< 背景 */
@property (nonatomic,strong) BaseView *baseView; /**< 基本视图 */

@property (nonatomic,strong) UIImageView *baseBackImageView; /**< 背景 */


@property (nonatomic,strong) MainTopView *topView; /**< 头部 */

@property (nonatomic,strong) FinanceInfoView *finView; /**< 金融资讯 */
@property (nonatomic,strong) BankBusinessView *bankBusView; /**< 银行业务 */
@property (nonatomic,strong) InvestmentFinancing *invesView; /**< 投资理财 */
@property (nonatomic,strong) CivilCardView *civilView; /**< 公民卡 */
@property (nonatomic,strong) PublicProductsView *pubProView; /**< 对公产品 */
@property (nonatomic,strong) WebSiteMapView *webSiteView; /**< 网点地图 */
@property (nonatomic,strong) MyBankView *myBankView; /**< 银行业务 */

-(void)initializeUserInterface; /**< 初始化用户界面 */
-(void)initializeDataSource;     //**< 初始化数据源 */

@end

@implementation MainViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    [self initializeDataSource];
    [self initializeUserInterface];
  
}

#pragma mark - initializeDataSource 初始化数据源
-(void)initializeDataSource{
    
}

#pragma mark - initializeUserInterface 初始化用户界面
-(void)initializeUserInterface{
    
    [self.view addSubview:self.backImageView];
    
    [self.view addSubview:self.leftMenus];
    [self.view addSubview:self.baseBackImageView];
    [self.view addSubview:self.baseView];
    [self.baseView addSubview:self.finView];
    
    [self.view addSubview:self.topView];
    

}
-(void)didReceiveMemoryWarning{
}
#pragma mark *** LeftMenusView ***

//选择某个cell，出现某个视图

-(void)LeftMenusView:(LeftMenusView *)leftMenusView didSelectedCellAtIndexPathRow:(NSInteger)indexRow{
    
    NSArray *arr = @[self.finView,self.bankBusView,self.invesView,self.civilView,self.pubProView,self.webSiteView,self.myBankView];
    
    for (UIView *view in self.baseView.subviews) {
        if (view) {
            [view removeFromSuperview];
        }
    }
    [self.baseView addSubview:arr[indexRow]];

    
}


#pragma mark *** getters ***
-(LeftMenusView *)leftMenus{
    if (!_leftMenus) {
        _leftMenus = [[LeftMenusView alloc] initWithFrame:AdaptationFrame(5, 82, 200, 700)];
        _leftMenus.delegate = self;
    }
    return _leftMenus;
}
-(UIImageView *)backImageView{
    if (!_backImageView) {
        _backImageView = [[UIImageView alloc] initWithFrame:self.view.frame];
        _backImageView.image = [UIImage imageNamed:@"大背景"];
    
    }
    
    return _backImageView;
}
-(BaseView *)baseView{
    if (!_baseView) {
        _baseView = [[BaseView alloc] initWithFrame:AdaptationFrame(110, 82, 900, 680)];
        
    }
    return _baseView;
}



-(UIImageView *)baseBackImageView{
    if (!_baseBackImageView) {
        _baseBackImageView = [[UIImageView alloc] initWithFrame:self.baseView.frame];
        _baseBackImageView.image = [UIImage imageNamed:@"中背景"];
    }
    return _baseBackImageView;
}

-(MainTopView *)topView{
    if (!_topView) {
        _topView = [[MainTopView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 100)];
    }
    return _topView;
}

#pragma mark *** allleftViewGetters ***

-(FinanceInfoView *)finView{
    if (!_finView) {
        _finView = [[FinanceInfoView alloc] initWithFrame:AllViewBaseFrame];
    }
    return _finView;
}
-(BankBusinessView *)bankBusView{
    if (!_bankBusView) {
        _bankBusView = [[BankBusinessView alloc] initWithFrame:AllViewBaseFrame];
    }
    return _bankBusView;
}
-(InvestmentFinancing *)invesView{
    if (!_invesView) {
        _invesView = [[InvestmentFinancing alloc] initWithFrame:AllViewBaseFrame];
    }
    return _invesView;
}
-(CivilCardView *)civilView{
    if (!_civilView) {
        _civilView = [[CivilCardView alloc] initWithFrame:AllViewBaseFrame];
        
    }
    return _civilView;
}
-(PublicProductsView *)pubProView{
    if (!_pubProView) {
        _pubProView = [[PublicProductsView alloc]initWithFrame:AllViewBaseFrame];
    }
    return _pubProView;
}
-(WebSiteMapView *)webSiteView{
    if (!_webSiteView) {
        _webSiteView = [[WebSiteMapView alloc] initWithFrame:AllViewBaseFrame];
    }
    return _webSiteView;
}
-(MyBankView *)myBankView{
    if (!_myBankView) {
        _myBankView = [[MyBankView alloc] initWithFrame:AllViewBaseFrame];
    }
    return _myBankView;
}


@end
